const app = getApp()
import Dialog from '@vant/weapp/dialog/dialog';
import {
    request_post
} from '../../utils/request';

Page({
    data: {
        info: null,
        examMock: {
            id: null,
            name: '',
            mobile: '',
            addr: '',
            pcdName: '',
            pcdCode: '' 
        },
    },
    onShow() {
        this.setData({
            info: app.globalData.student
        })
        if (!this.data.info) return

        request_post('/exam-mock/get-my').then(res => {
            this.setData({
                examMock: res
            })
        })
    },
    jumpToLogin() {
        wx.navigateTo({
            url: '/pages/login/index?page=user'
        })
    },
    logout() {
        Dialog.confirm({
                width: '90vw',
                title: '确认退出当前账号',
            })
            .then(() => {
                request_post('/mini-app/auth/logout').then(res => {
                    app.globalData.student = null
                    this.onShow()
                })
            })
            .catch(() => {

            });
    },
    jumpToAddrModify() {
        wx.navigateTo({
            url: '/pages/exam-mock/index'
        })
    },
   
})